<!--
 * @Description: 设备保养
 * @Author: lwx
 * @Date: 2022-06-17 14:58:09
 * @LastEditors: lwx
 * @LastEditTime: 2023-04-23 13:44:01
-->
<template>
  <div class="device_maintain">
    <dv-scroll-board
      :config="config"
      style="width: 100%; height: 2.9rem"
    />
  </div>
</template>

<script>
import { timerMixins } from "@/common/mixins/timerMixins.js";
import { machineService } from "@/api/dashboard.js";
export default {
  name: "DeviceMaintain",
  mixins: [timerMixins],
  components: {},
  data() {
    return {
      config: {
        header: ["设备名称", "设备状态", "下次保养时间"],
        data: [],
        rowNum: 5, //表格行数
        headerHeight: 35,
        headerBGC: "rgba(255, 255, 255, 0.1)", //表头
        oddRowBGC: "#0f1325", //奇数行
        evenRowBGC: "#171c33", //偶数行
        index: false,
        columnWidth:[120,100,160],
        align: ["center", "center", "center"],
      },
    };
  },
  methods: {
    async initData() {
      const { data } = await machineService();
      const deviceList = data;
      let arr = [];
      if (deviceList && deviceList.length > 0) {
        for (let i in deviceList) {
          let name = deviceList[i].name;
          let enable = deviceList[i].enable === true ? "启用中" : "禁用";
          let operate =
            deviceList[i].operate === null ? "无" : deviceList[i].operate;
          arr.push([name, enable, operate]);
        }
        let nowData = this.config;
        nowData.data = arr;
        this.config = { ...nowData };
      }
    },
  },
};
</script>
<style lang='scss' scoped>
.device_maintain{
  width: 5.5rem;
  padding: 0 .2814rem
}
/deep/.dv-scroll-board .header {
  font-size: 0.24rem !important;
  color: #68d8fe;
}
/deep/.dv-scroll-board .rows .row-item {
  font-size: 0.21rem !important;
  color: #61a8ff;
}
/deep/.dv-scroll-board .rows .ceil {
  padding: 0 0.125rem;
}
</style>